package com.wgworkshop.pems.entity;

import com.wgworkshop.pems.model.ClassHourViewRecord;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 课时实体类。
 * Created by wlc on 2017/7/7.
 */
@Entity(name = "class_hour")
@SqlResultSetMapping(
        name = "ClassHourViewRecordMapping",
        classes = {
                @ConstructorResult(
                        targetClass = ClassHourViewRecord.class,
                        columns = {
                                @ColumnResult(name = "id", type = Long.class),
                                @ColumnResult(name = "code", type = String.class),
                                @ColumnResult(name = "name", type = String.class),
                                @ColumnResult(name = "total_class_hour", type = Integer.class),
                                @ColumnResult(name = "start_date", type = Date.class),
                                @ColumnResult(name = "class_num", type = Integer.class),
                                @ColumnResult(name = "cost", type = BigDecimal.class),
                                @ColumnResult(name = "used_class_hour", type = Integer.class)
                        }
                )
        }
)
public class ClassHourEntity extends AbstractBaseEntity {
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn
    private StudentEntity student;
    private Integer classHour;
    private BigDecimal cost;
    @Temporal(TemporalType.DATE)
    private Date operateDate;

    public StudentEntity getStudent() {
        return student;
    }

    public void setStudent(StudentEntity student) {
        this.student = student;
    }

    public Integer getClassHour() {
        return classHour;
    }

    public void setClassHour(Integer classHour) {
        this.classHour = classHour;
    }

    public BigDecimal getCost() {
        return cost;
    }

    public void setCost(BigDecimal cost) {
        this.cost = cost;
    }

    public Date getOperateDate() {
        return operateDate;
    }

    public void setOperateDate(Date operateDate) {
        this.operateDate = operateDate;
    }
}
